package com.example.blank700.autocompletetextview;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.MultiAutoCompleteTextView;

public class AutoCompleteTextViewActivity extends AppCompatActivity {
    private static final String[] autoStr = new String[]{"bla", "blan", "blank", "blank700"};

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_auto_complete_text_view);

        /* AutoCompleteTextView */
        ArrayAdapter adapter = new ArrayAdapter(this, android.R.layout.simple_dropdown_item_1line, autoStr);
        AutoCompleteTextView myAutoCompleteTextView=(AutoCompleteTextView)findViewById(R.id.myAutoCompleteTextView);
        myAutoCompleteTextView.setAdapter(adapter);

        /* MultiAutoCompleteTextView */
        MultiAutoCompleteTextView myMultiAutoCompleteTextView=(MultiAutoCompleteTextView)findViewById(R.id.myMultiAutoCompleteTextView);
        myMultiAutoCompleteTextView.setAdapter(adapter);
        myMultiAutoCompleteTextView.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
    }
}
